package gold.digger;

/**
 * Created by fanzhenyu02 on 2020/6/27.
 * common problem solver template.
 */
public class LC389 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public char findTheDifference(String s, String t) {
            int[] bit = new int[26];
            for (char ch : s.toCharArray()) {
                bit[ch - 'a']++;
            }

            for (char ch : t.toCharArray()) {
                bit[ch - 'a']--;
            }

            for (int i = 0; i < 26; i++) {
                if (bit[i] != 0) return (char) ('a' + i);
            }

            return 'a';
        }
    }

    public void run() {
        Solution solution = new Solution();
        System.out.println(solution.findTheDifference("abcd", "abced"));
    }

    public static void main(String[] args) throws Exception {
        LC389 an = new LC389();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
